Repository navigation
Conversation
render() built a fresh 19-key object literal for the ModalStateContext provider on every render, forcing every consumer to re-render even when nothing it reads had changed. Uses the house react/utils/memoizeOne.js helper, same pattern already established for the geolocation context. The memoized factory takes the same 19 state/prop values as positional args (the class-property arrow handlers are read from this, stable for the instance's lifetime), so a shallow positional compare is sound. File: react/ModalState.js:521 Rule: javascript:S6481
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
🛡️ SDD Check — action requiredI couldn't detect an SDD in this PR. Please check one option below (requires write access to the repo):
|
| shouldSearchArea, | ||
| showOtherPickupPoints | ||
| ) => ({ | ||
| activeState, |
There was a problem hiding this comment.
acho que vale tentar ignorar essa regra do sonar nesse bloco de código, oq acha @huandrey ?
There was a problem hiding this comment.
Concordo, @jeffersontuc. Segui com a supressão em bf8c7a7: /* NOSONAR javascript:S107 */ na linha do =>, que é onde o Sonar ancora o S107, mais um comentário acima do getContextValue explicando o motivo. O memoizeOne compara os argumentos por identidade, então agrupar tudo num objeto quebraria a memoização.
Considerei a alternativa de memoizar em cima de this.state (um parâmetro só, sem supressão), mas ela reconstruiria o value em qualquer setState, inclusive de campos que nem estão no contexto (askForGeolocation, localSearching). Preferi manter a memoização precisa.
Detalhe: usei comentário de bloco porque o Prettier move um // NOSONAR de fim de linha para dentro do objeto, e aí a supressão para de valer.
…d context builder One positional argument per context field is deliberate: memoizeOne compares arguments by identity, so grouping them into an object would defeat the memoization. A block comment keeps the NOSONAR on the arrow line where Sonar anchors the issue (Prettier moves a trailing // comment into the object body). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QdDDu2mUJJfM3vfG227Uqr
|


0 New Issues
1 Fixed Issue
0 Accepted Issues
SonarQube auto-fix — performance
Generated by
sonar-autofix. Each commit resolves one issue.All fixes were independently reviewed by a judge-agent before being committed.
Skipped in this group: 0 issues
Note:
react/ModalState.jsis a root/public component per AGENTS.md and requires human approval before merge.